home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / ANIVGA.ZIP / EXAMPLE8.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-08-17  |  2.7 KB  |  73 lines

  1. PROGRAM Example8;
  2.  
  3. {Demonstrates the several available fading routines: the program waits for}
  4. {the user to press a key (A..Y without Q, ESC=quit), fills the visible    }
  5. {page with a few thousand randomly distributed & colored points and then  }
  6. {fades in the background page again, using the selected method.}
  7. {To end the program, you have to press ESC! }
  8.  
  9. USES ANIVGA,CRT;
  10.  
  11. CONST ch:Char=#0;
  12. VAR i,j:Integer;
  13.  
  14. BEGIN
  15.  
  16.  InitGraph;
  17.  
  18.  FOR i:=15 TO 78 DO
  19.   BEGIN {draw some colors on the screen}
  20.    Color:=i;
  21.    FOR j:=(i-15)*5 TO (i-15)*5+4 DO BackgroundLine(j,0,j,YMAX)
  22.   END;
  23.  BackGroundOutTextXY(90,YMAX SHR 1,'Press a key (A..P,R..Y, ESC=quit)');
  24.  
  25.  Animate; {just to initialize pages, evtl. placed sprites, etc}
  26.  REPEAT   {now for the opening sequence:}
  27.   if keypressed
  28.    THEN BEGIN
  29.          while keypressed do ch:=upcase(readkey);
  30.          if pos(ch,'ABCDEFGHIJKLMNOPRSTUVWXY')>0
  31.           THEN BEGIN
  32.                 FillPage(1-PAGE,Black);
  33.                 FOR i:=1 TO 20000 DO
  34.                  BEGIN
  35.                   PutPixel(Random(Succ(XMAX)),Random(Succ(YMAX)),Random(256))
  36.                  END;
  37.                 Delay(1000);
  38.                END;
  39.          case ch of
  40.           'A':FadeIn(BACKGNDPAGE,2000,Fade_Squares);
  41.           'B':FadeIn(BACKGNDPAGE,2000,Fade_Circles);
  42.           'C':FadeIn(BACKGNDPAGE,2000,Fade_Moiree1);
  43.           'D':FadeIn(BACKGNDPAGE,2000,Fade_Moiree2);
  44.           'E':FadeIn(BACKGNDPAGE,2000,Fade_Moiree3);
  45.           'F':FadeIn(BACKGNDPAGE,2000,Fade_Moiree4);
  46.           'G':FadeIn(BACKGNDPAGE,2000,Fade_Moiree5);
  47.           'H':FadeIn(BACKGNDPAGE,2000,Fade_Moiree6);
  48.           'I':FadeIn(BACKGNDPAGE,2000,Fade_Moiree7);
  49.           'J':FadeIn(BACKGNDPAGE,2000,Fade_Moiree8);
  50.           'K':FadeIn(BACKGNDPAGE,2000,Fade_Moiree9);
  51.           'L':FadeIn(BACKGNDPAGE,2000,Fade_Moiree10);
  52.           'M':FadeIn(BACKGNDPAGE,2000,Fade_Moiree11);
  53.           'N':FadeIn(BACKGNDPAGE,2000,Fade_Moiree12);
  54.           'O':FadeIn(BACKGNDPAGE,2000,Fade_Moiree13);
  55.           'P':FadeIn(BACKGNDPAGE,2000,Fade_Moiree14);
  56.           'Q':BEGIN Sound(100); Delay(100); Nosound END;
  57.           'R':FadeIn(BACKGNDPAGE,2000,Fade_SweepInFromLeft);
  58.           'S':FadeIn(BACKGNDPAGE,2000,Fade_SweepInFromRight);
  59.           'T':FadeIn(BACKGNDPAGE,2000,Fade_SweepInFromTop);
  60.           'U':FadeIn(BACKGNDPAGE,2000,Fade_SweepInFromBottom);
  61.           'V':FadeIn(BACKGNDPAGE,2000,Fade_ScrollInFromLeft);
  62.           'W':FadeIn(BACKGNDPAGE,2000,Fade_ScrollInFromRight);
  63.           'X':FadeIn(BACKGNDPAGE,2000,Fade_ScrollInFromTop);
  64.           'Y':FadeIn(BACKGNDPAGE,2000,Fade_ScrollInFromBottom);
  65.          end;
  66.         END;
  67.   {Your normal program would follow here!}
  68.  UNTIL (ch=#27);
  69.  
  70.  CloseRoutines;
  71.  
  72. END.
  73.